
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module gdata.tlslite.utils.PyCrypto_RSAKey</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="gdata.html"><font color="#ffffff">gdata</font></a>.<a href="gdata.tlslite.html"><font color="#ffffff">tlslite</font></a>.<a href="gdata.tlslite.utils.html"><font color="#ffffff">utils</font></a>.PyCrypto_RSAKey</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/afshar/wrk/gdata-python-client/src/gdata/tlslite/utils/PyCrypto_RSAKey.py">/home/afshar/wrk/gdata-python-client/src/gdata/tlslite/utils/PyCrypto_RSAKey.py</a></font></td></tr></table>
    <p><tt>PyCrypto&nbsp;RSA&nbsp;implementation.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="Crypto.html">Crypto</a><br>
<a href="Crypto.PublicKey.RSA.html">Crypto.PublicKey.RSA</a><br>
<a href="array.html">array</a><br>
</td><td width="25%" valign=top><a href="base64.html">base64</a><br>
<a href="binascii.html">binascii</a><br>
<a href="math.html">math</a><br>
</td><td width="25%" valign=top><a href="os.html">os</a><br>
<a href="sys.html">sys</a><br>
<a href="traceback.html">traceback</a><br>
</td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="gdata.tlslite.utils.RSAKey.html#RSAKey">gdata.tlslite.utils.RSAKey.RSAKey</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="gdata.tlslite.utils.PyCrypto_RSAKey.html#PyCrypto_RSAKey">PyCrypto_RSAKey</a>
</font></dt></dl>
</dd>
</dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="PyCrypto_RSAKey">class <strong>PyCrypto_RSAKey</strong></a>(<a href="gdata.tlslite.utils.RSAKey.html#RSAKey">gdata.tlslite.utils.RSAKey.RSAKey</a>)</font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="PyCrypto_RSAKey-__getattr__"><strong>__getattr__</strong></a>(self, name)</dt></dl>

<dl><dt><a name="PyCrypto_RSAKey-__init__"><strong>__init__</strong></a>(self, n<font color="#909090">=0</font>, e<font color="#909090">=0</font>, d<font color="#909090">=0</font>, p<font color="#909090">=0</font>, q<font color="#909090">=0</font>, dP<font color="#909090">=0</font>, dQ<font color="#909090">=0</font>, qInv<font color="#909090">=0</font>)</dt></dl>

<dl><dt><a name="PyCrypto_RSAKey-hasPrivateKey"><strong>hasPrivateKey</strong></a>(self)</dt></dl>

<dl><dt><a name="PyCrypto_RSAKey-hash"><strong>hash</strong></a>(self)</dt></dl>

<dl><dt><a name="PyCrypto_RSAKey-writeXMLPublicKey"><strong>writeXMLPublicKey</strong></a>(self, indent<font color="#909090">=''</font>)</dt></dl>

<hr>
Static methods defined here:<br>
<dl><dt><a name="PyCrypto_RSAKey-generate"><strong>generate</strong></a>(bits)</dt></dl>

<hr>
Methods inherited from <a href="gdata.tlslite.utils.RSAKey.html#RSAKey">gdata.tlslite.utils.RSAKey.RSAKey</a>:<br>
<dl><dt><a name="PyCrypto_RSAKey-__len__"><strong>__len__</strong></a>(self)</dt><dd><tt>Return&nbsp;the&nbsp;length&nbsp;of&nbsp;this&nbsp;key&nbsp;in&nbsp;bits.<br>
&nbsp;<br>
@rtype:&nbsp;int</tt></dd></dl>

<dl><dt><a name="PyCrypto_RSAKey-acceptsPassword"><strong>acceptsPassword</strong></a>(self)</dt><dd><tt>Return&nbsp;True&nbsp;if&nbsp;the&nbsp;<a href="#PyCrypto_RSAKey-write">write</a>()&nbsp;method&nbsp;accepts&nbsp;a&nbsp;password&nbsp;for&nbsp;use<br>
in&nbsp;encrypting&nbsp;the&nbsp;private&nbsp;key.<br>
&nbsp;<br>
@rtype:&nbsp;bool</tt></dd></dl>

<dl><dt><a name="PyCrypto_RSAKey-decrypt"><strong>decrypt</strong></a>(self, encBytes)</dt><dd><tt>Decrypt&nbsp;the&nbsp;passed-in&nbsp;bytes.<br>
&nbsp;<br>
This&nbsp;requires&nbsp;the&nbsp;key&nbsp;to&nbsp;have&nbsp;a&nbsp;private&nbsp;component.&nbsp;&nbsp;It&nbsp;performs<br>
PKCS1&nbsp;decryption&nbsp;of&nbsp;the&nbsp;passed-in&nbsp;data.<br>
&nbsp;<br>
@type&nbsp;encBytes:&nbsp;L{array.array}&nbsp;of&nbsp;unsigned&nbsp;bytes<br>
@param&nbsp;encBytes:&nbsp;The&nbsp;value&nbsp;which&nbsp;will&nbsp;be&nbsp;decrypted.<br>
&nbsp;<br>
@rtype:&nbsp;L{array.array}&nbsp;of&nbsp;unsigned&nbsp;bytes&nbsp;or&nbsp;None.<br>
@return:&nbsp;A&nbsp;PKCS1&nbsp;decryption&nbsp;of&nbsp;the&nbsp;passed-in&nbsp;data&nbsp;or&nbsp;None&nbsp;if<br>
the&nbsp;data&nbsp;is&nbsp;not&nbsp;properly&nbsp;formatted.</tt></dd></dl>

<dl><dt><a name="PyCrypto_RSAKey-encrypt"><strong>encrypt</strong></a>(self, bytes)</dt><dd><tt>Encrypt&nbsp;the&nbsp;passed-in&nbsp;bytes.<br>
&nbsp;<br>
This&nbsp;performs&nbsp;PKCS1&nbsp;encryption&nbsp;of&nbsp;the&nbsp;passed-in&nbsp;data.<br>
&nbsp;<br>
@type&nbsp;bytes:&nbsp;L{array.array}&nbsp;of&nbsp;unsigned&nbsp;bytes<br>
@param&nbsp;bytes:&nbsp;The&nbsp;value&nbsp;which&nbsp;will&nbsp;be&nbsp;encrypted.<br>
&nbsp;<br>
@rtype:&nbsp;L{array.array}&nbsp;of&nbsp;unsigned&nbsp;bytes.<br>
@return:&nbsp;A&nbsp;PKCS1&nbsp;encryption&nbsp;of&nbsp;the&nbsp;passed-in&nbsp;data.</tt></dd></dl>

<dl><dt><a name="PyCrypto_RSAKey-getSigningAlgorithm"><strong>getSigningAlgorithm</strong></a>(self)</dt><dd><tt>Return&nbsp;the&nbsp;cryptoID&nbsp;sigAlgo&nbsp;value&nbsp;corresponding&nbsp;to&nbsp;this&nbsp;key.<br>
&nbsp;<br>
@rtype:&nbsp;str</tt></dd></dl>

<dl><dt><a name="PyCrypto_RSAKey-hashAndSign"><strong>hashAndSign</strong></a>(self, bytes)</dt><dd><tt>Hash&nbsp;and&nbsp;sign&nbsp;the&nbsp;passed-in&nbsp;bytes.<br>
&nbsp;<br>
This&nbsp;requires&nbsp;the&nbsp;key&nbsp;to&nbsp;have&nbsp;a&nbsp;private&nbsp;component.&nbsp;&nbsp;It&nbsp;performs<br>
a&nbsp;PKCS1-SHA1&nbsp;signature&nbsp;on&nbsp;the&nbsp;passed-in&nbsp;data.<br>
&nbsp;<br>
@type&nbsp;bytes:&nbsp;str&nbsp;or&nbsp;L{array.array}&nbsp;of&nbsp;unsigned&nbsp;bytes<br>
@param&nbsp;bytes:&nbsp;The&nbsp;value&nbsp;which&nbsp;will&nbsp;be&nbsp;hashed&nbsp;and&nbsp;signed.<br>
&nbsp;<br>
@rtype:&nbsp;L{array.array}&nbsp;of&nbsp;unsigned&nbsp;bytes.<br>
@return:&nbsp;A&nbsp;PKCS1-SHA1&nbsp;signature&nbsp;on&nbsp;the&nbsp;passed-in&nbsp;data.</tt></dd></dl>

<dl><dt><a name="PyCrypto_RSAKey-hashAndVerify"><strong>hashAndVerify</strong></a>(self, sigBytes, bytes)</dt><dd><tt>Hash&nbsp;and&nbsp;verify&nbsp;the&nbsp;passed-in&nbsp;bytes&nbsp;with&nbsp;the&nbsp;signature.<br>
&nbsp;<br>
This&nbsp;verifies&nbsp;a&nbsp;PKCS1-SHA1&nbsp;signature&nbsp;on&nbsp;the&nbsp;passed-in&nbsp;data.<br>
&nbsp;<br>
@type&nbsp;sigBytes:&nbsp;L{array.array}&nbsp;of&nbsp;unsigned&nbsp;bytes<br>
@param&nbsp;sigBytes:&nbsp;A&nbsp;PKCS1-SHA1&nbsp;signature.<br>
&nbsp;<br>
@type&nbsp;bytes:&nbsp;str&nbsp;or&nbsp;L{array.array}&nbsp;of&nbsp;unsigned&nbsp;bytes<br>
@param&nbsp;bytes:&nbsp;The&nbsp;value&nbsp;which&nbsp;will&nbsp;be&nbsp;hashed&nbsp;and&nbsp;verified.<br>
&nbsp;<br>
@rtype:&nbsp;bool<br>
@return:&nbsp;Whether&nbsp;the&nbsp;signature&nbsp;matches&nbsp;the&nbsp;passed-in&nbsp;data.</tt></dd></dl>

<dl><dt><a name="PyCrypto_RSAKey-sign"><strong>sign</strong></a>(self, bytes)</dt><dd><tt>Sign&nbsp;the&nbsp;passed-in&nbsp;bytes.<br>
&nbsp;<br>
This&nbsp;requires&nbsp;the&nbsp;key&nbsp;to&nbsp;have&nbsp;a&nbsp;private&nbsp;component.&nbsp;&nbsp;It&nbsp;performs<br>
a&nbsp;PKCS1&nbsp;signature&nbsp;on&nbsp;the&nbsp;passed-in&nbsp;data.<br>
&nbsp;<br>
@type&nbsp;bytes:&nbsp;L{array.array}&nbsp;of&nbsp;unsigned&nbsp;bytes<br>
@param&nbsp;bytes:&nbsp;The&nbsp;value&nbsp;which&nbsp;will&nbsp;be&nbsp;signed.<br>
&nbsp;<br>
@rtype:&nbsp;L{array.array}&nbsp;of&nbsp;unsigned&nbsp;bytes.<br>
@return:&nbsp;A&nbsp;PKCS1&nbsp;signature&nbsp;on&nbsp;the&nbsp;passed-in&nbsp;data.</tt></dd></dl>

<dl><dt><a name="PyCrypto_RSAKey-verify"><strong>verify</strong></a>(self, sigBytes, bytes)</dt><dd><tt>Verify&nbsp;the&nbsp;passed-in&nbsp;bytes&nbsp;with&nbsp;the&nbsp;signature.<br>
&nbsp;<br>
This&nbsp;verifies&nbsp;a&nbsp;PKCS1&nbsp;signature&nbsp;on&nbsp;the&nbsp;passed-in&nbsp;data.<br>
&nbsp;<br>
@type&nbsp;sigBytes:&nbsp;L{array.array}&nbsp;of&nbsp;unsigned&nbsp;bytes<br>
@param&nbsp;sigBytes:&nbsp;A&nbsp;PKCS1&nbsp;signature.<br>
&nbsp;<br>
@type&nbsp;bytes:&nbsp;L{array.array}&nbsp;of&nbsp;unsigned&nbsp;bytes<br>
@param&nbsp;bytes:&nbsp;The&nbsp;value&nbsp;which&nbsp;will&nbsp;be&nbsp;verified.<br>
&nbsp;<br>
@rtype:&nbsp;bool<br>
@return:&nbsp;Whether&nbsp;the&nbsp;signature&nbsp;matches&nbsp;the&nbsp;passed-in&nbsp;data.</tt></dd></dl>

<dl><dt><a name="PyCrypto_RSAKey-write"><strong>write</strong></a>(self, password<font color="#909090">=None</font>)</dt><dd><tt>Return&nbsp;a&nbsp;string&nbsp;containing&nbsp;the&nbsp;key.<br>
&nbsp;<br>
@rtype:&nbsp;str<br>
@return:&nbsp;A&nbsp;string&nbsp;describing&nbsp;the&nbsp;key,&nbsp;in&nbsp;whichever&nbsp;format&nbsp;(PEM<br>
or&nbsp;XML)&nbsp;is&nbsp;native&nbsp;to&nbsp;the&nbsp;implementation.</tt></dd></dl>

</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-sha1"><strong>sha1</strong></a> = openssl_sha1(...)</dt><dd><tt>Returns&nbsp;a&nbsp;sha1&nbsp;hash&nbsp;object;&nbsp;optionally&nbsp;initialized&nbsp;with&nbsp;a&nbsp;string</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>cryptlibpyLoaded</strong> = False<br>
<strong>gmpyLoaded</strong> = False<br>
<strong>m2cryptoLoaded</strong> = False<br>
<strong>prngName</strong> = 'os.urandom'<br>
<strong>pycryptoLoaded</strong> = True<br>
<strong>sieve</strong> = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, ...]</td></tr></table>
</body></html>